home *** CD-ROM | disk | FTP | other *** search
/ Workplace Effectiveness: Critical Thinking Skills / Workplace Effectiveness: Critical Thinking Skills.iso / pc / Files / Clue.dxr / 00023_set One of a Group.ls < prev    next >
Encoding:
Text File  |  1998-09-17  |  2.0 KB  |  61 lines

  1. property firstSprite, Letter, questionNum
  2. global gClueData
  3.  
  4. on beginSprite me
  5.   set vbuttonNum to the spriteNum of me - (the firstSprite of me - 1)
  6.   case vbuttonNum of
  7.     1:
  8.       set the Letter of me to #a
  9.     2:
  10.       set the Letter of me to #b
  11.     3:
  12.       set the Letter of me to #c
  13.     4:
  14.       set the Letter of me to #d
  15.   end case
  16.   setPrevChoice(me)
  17. end
  18.  
  19. on setPrevChoice me
  20.   set chosenOne to getAt(the clickChoices of gClueData, the questionNum of me)
  21.   if chosenOne = the Letter of me then
  22.     sendSprite(the spriteNum of me, #Toggle)
  23.   end if
  24. end
  25.  
  26. on mouseDown me
  27.   set chosenOne to getAt(the clickChoices of gClueData, the questionNum of me)
  28.   if chosenOne = the Letter of me then
  29.     setAt(the clickChoices of gClueData, the questionNum of me, 0)
  30.   else
  31.     if chosenOne <> #e then
  32.       unclickAnother(me, chosenOne)
  33.     end if
  34.     setAt(the clickChoices of gClueData, the questionNum of me, the Letter of me)
  35.   end if
  36. end
  37.  
  38. on unclickAnother me, prevChoice
  39.   case prevChoice of
  40.     #a:
  41.       set vNumber to 1
  42.     #b:
  43.       set vNumber to 2
  44.     #c:
  45.       set vNumber to 3
  46.     #d:
  47.       set vNumber to 4
  48.   end case
  49.   set otherSprite to the firstSprite of me + (vNumber - 1)
  50.   sendSprite(otherSprite, #Toggle)
  51. end
  52.  
  53. on getPropertyDescriptionList
  54.   set p_list to [#questionNum: [#comment: "Question number for this button:", #format: #integer, #range: [#min: 1, #max: 21], #default: 1], #firstSprite: [#comment: "First sprite of series:", #format: #integer, #range: [7, 8, 9, 10], #default: 7]]
  55.   return p_list
  56. end
  57.  
  58. on getBehaviorDescription
  59.   return "Each sprite will know its position in a group based on its sprite number." & RETURN & "It will also know what question it is applied to." & RETURN & "From these properties we can keep score in a global." & RETURN & "‚Ä¢ Question number - choose from the range." & RETURN & "‚Ä¢ First sprite - so the first sprite in the series gets a 1, etc." & RETURN & "NOTES:" & RETURN & "Uses global variable to keep track of button position, ON or OFF."
  60. end
  61.